import { request } from "@/utils/http";

export const addCartAPI = (data) => {
  return request({
    url: '/member/cart',
    method: 'POST',
    data
  })
};



/**
 * 请求列表
 */
export const getCartsAPI = () => {
  return request({
    url: "/member/cart",
  });
};

export const updateCartAPI = (skuId, selected, count) => {
  return request({
    url: `/member/cart/${skuId}`,
    method: "PUT",
    data: { selected, count },
  });
};

// 1. 
export const updateAllCartAPI = (selected) => {
  return request({
    url: `/member/cart/selected`,
    method: "PUT",
    data: { selected },
  });
};

/**
 * 删除购物车 id
 */
export const delCartByIdAPI = (id) => {
  return request({
    url: `/member/cart`,
    method: "delete",
    data: { ids: [id] },
  });
};